package com.axcbd.demo.repository;

import com.axcbd.demo.model.CameraInformation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

public interface CameraInformationRepository extends JpaRepository<CameraInformation,Integer> {
    List<CameraInformation> findByCameraid(int cameraid);
    @Query("SELECT i FROM CameraInformation i WHERE i.cameraid = :cameraid AND i.createdat BETWEEN :startOfDay AND :endOfDay")
    List<CameraInformation> findByDateRange(int cameraid,@Param("startOfDay") Date startOfDay, @Param("endOfDay") Date endOfDay);
}
